import express from 'express';
import cors from 'cors';

// 导入路由模块
import authRoutes from './routes/auth.js';
import userRoutes from './routes/user.js';
import testRoutes from './routes/test.js';
<<<<<<< HEAD
import aiRoutes from './routes/ai.js';
import trainingsRoutes from './routes/trainings.js';
import myTrainingsRoutes from './routes/mytrainings.js';
import migrateRoutes from './routes/migrate.js';
=======
import trainingRoutes from './routes/training.js';
>>>>>>> f05919ca9405ab61064b68abb04f483b35a2ec92

const app = express();

// 中间件
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

// 注册路由
app.use('/api', testRoutes);      // 测试相关路由
app.use('/api/auth', authRoutes); // 认证相关路由
app.use('/api/user', userRoutes); // 用户相关路由
<<<<<<< HEAD
app.use('/api/ai', aiRoutes);     // AI相关路由
app.use('/api/trainings', trainingsRoutes); // 训练课程路由
app.use('/api/mytrainings', myTrainingsRoutes); // 我的训练计划路由
app.use('/api/migrate', migrateRoutes); // 迁移/建表路由
=======
app.use('/api/training', trainingRoutes); // 训练相关路由
>>>>>>> f05919ca9405ab61064b68abb04f483b35a2ec92

export default app;